
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">日常费用报销申请</h2>
    </div>
    <!-- 标题 -->
    <div class="contact-box">
        <button class="btn btn-info" type="button" onclick="daochu({$aid})">导出Excel打印版</button>
    </div>
     <table class="table table-bordered text-center bud_hei" style="margin-bottom: 0">
        <tr>
          <td style="min-width: 160px;width: 160px">单号</td>
            <td class="text-left" colspan="3">{$apply.no}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">代办人(申请人)：</td>
            <td class="text-left">{$apply.cman}</td>
            <td style="min-width: 160px;width: 160px">报销单创建日期：</td>
            <td class="text-left">{$apply.ctime}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">报销单主题：</td>
            <td class="text-left" colspan="3">{$apply.title}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">报销归入考核期：</td>
            <td class="text-left">{$apply.kaohe}</td>
            <td style="min-width: 160px;width: 160px">支付方式：</td>
            <td class="text-left">{$apply.payway}</td>
        </tr>
         <tr>
            
            <td style="min-width: 160px;width: 160px">报销事由：</td>
            <td class="text-left"  colspan="3">{$apply.reason}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">费用计入部门：</td>
            <td class="text-left">{$apply.jrbm}</td>
            <td style="min-width: 160px;width: 160px">报销人：</td>
            <td class="text-left">{$apply.bman}</td>
        </tr>
        <tr>
            <td style="min-width: 160px;width: 160px">关联出差申请单号：</td>
            <td class="text-left">
                {if $apply.chuchai}
                    <div class="row">
                        {volist name="$apply.chuchai" id="c"}
                            <div class="col-xs-4">
                                <a class="J_menuItem detail" title="{$c.no}" href="{:url('Chuchai/detail')}?aid={$c.id}">{$c.no}({$c.title})</a>
                            </div>
                        {/volist}
                    </div>
                {else/}
                    <b>无关联的出差申请</b>
                {/if}
            </td>
            <td></td>
            <td></td>
        </tr>
          <tr>
            <td style="min-width: 160px;width: 160px">关联万用申请单号：</td>
            <td class="text-left" colspan="3">
                {if $apply.wanneng}
                    <div class="row">
                        {volist name="$apply.wanneng" id="c"}
                            <div class="col-xs-4">
                                <a class="J_menuItem detail" title="{$c.no}" href="{:url('Wanyongapply/detail')}?aid={$c.id}">{$c.no}({$c.title})</a>
                            </div>
                        {/volist}
                    </div>
                {else/}
                    <b>无关联的万能申请</b>
                {/if}
            </td>
        </tr>
        {if $apply.state==8}
            <tr>
                <td style="min-width: 160px;width: 160px">作废人：</td>
                <td class="text-left">{$apply.zuofeiman}</td>
                <td style="min-width: 160px;width: 160px">作废时间：</td>
                <td class="text-left">{$apply.zuofeitime}</td>
            </tr>
             <tr>
            <td style="min-width: 160px;width: 160px">作废原因：</td>
            <td class="text-left" colspan="3">
               {$apply.zuofeireason}
            </td>
        </tr>
        {/if}
    </table>
    <form id="f1">
        <input type="hidden" name="aid" value="{$aid}">
      <table class="table table-bordered text-center bud_hei">
      <tr>
        <th class="font-bold" colspan="11">金额单位：元</th>
      </tr>
        <tr class="info">
            <th class="text-center">审批人</th>
            <th class="text-center">序号</th>
            <th class="text-center">起止时间</th>
            <th class="text-center">出发地点</th>
            <th class="text-center">到达地点</th>
            {volist name="feiyong" id="f"}
                <th class="text-center">{$f.title}/批准金额</th>
            {/volist}
            <th class="text-center">费用说明</th>
            <th class="text-center">费用计入<br>经销商</th>
            <th class="text-center">状态</th>
        </tr>
        {volist name="applyde" id="de" key="k"}
         <tr>
           <td>{$de.em_name}</td>
           <td>{$k}</td>
           <td>从{$de.start} <br>至{$de.end}</td>
           <td class="text-left">{$de.chufa}</td>
           <td class="text-left">{$de.mudi}</td>
           {volist name="feiyong" id="f" key="fk"}
                <td class="text-right">
                    <span>
                   
                        {if $de.feiid==$f.id}
                            {$de.feis}
                            <input type="hidden"   name="pizhun[feis][]"  value="{$de.feis}"/>
                        {/if}
                    
                    </span> {if $de.feiid==$f.id}/{/if}
                    <span>
                     
                        {if $de.feiid==$f.id}
                            <input type="hidden"   name="pizhun[did][]"  value="{$de.id}"/>
                           <input type="text"  {if $de.state==3}readonly{/if} class="num2i jisuan{$fk} pizhun" name="pizhun[pifu][]" did="{$de.id}" value="{$de.pizhunfeiyong}"/>
                        {/if}
                    
                    </span>
                </td>
            {/volist}
           <td>{$de.remark}</td>
           <td>{$de.jxs}</td>
           <td>
                {if $de.state==3}
                    <label><input type="radio" name="pizhun[state][{$de.id}]" value='2' class="pz" did="{$de.id}">批准</label>
                    <label><input type="radio" name="pizhun[state][{$de.id}]" value='3' class="fj" did="{$de.id}" checked>否决</label>
                {else/}
                    <label><input type="radio" name="pizhun[state][{$de.id}]" value='2' class="pz" did="{$de.id}" checked>批准</label>
                    <label><input type="radio" name="pizhun[state][{$de.id}]" value='3' class="fj" did="{$de.id}">否决</label>
                {/if}
           </td>
        </tr>
        {/volist}
        <tr class="trTotal1 font-bold text-right">
            <td colspan="5" class="text-right font-bold">合计</td>
            {volist name="feiyong" id="f" key="fk"}
            <td class="ObjectNum num2 he{$fk}">100</td>
            {/volist}
            <td colspan="3">报销总金额：<span class="ObjectNum num2 zonghe">110</span>元</td>
        </tr>
        </table>
    </form>
        <table class="table table-bordered text-left bud_hei">
            <tr class="info">
                <th class="text-left font-bold">审批意见</th>
            </tr>
            {volist name="logs" id="l"}
          <tr>
              <td>{$l.USERNAME} 审批动作：{$l.MEMO}；审批意见：{if $l.COMMENTS}{$l.COMMENTS}{else/}无{/if}(审批时间：{$l.ACTIONTIME})</td>
          </tr>
          
          {/volist}
      </table>
         <table class="table table-bordered text-left bud_hei">
            <tr>
                <th class="text-left info">支付信息</th>
            </tr>
            <tr><td>总报销金额：<span class="ObjectNum num2">{$apply.pizhunjin}</span>元 已支付金额：<span class="ObjectNum num2">{$apply.zhifujin}</span>元 未支付金额：<span class="ObjectNum num2">{$apply.weifujin}</span>元</td></tr>
            {if $zhifu}
            {volist name="zhifu" id="z"}
            <tr>
                
                <td>支付信息：费用凭证：<span>{$z.pzno}</span> 录入人：<span>{$z.cu}</span> 录入时间：<span>{$z.ctime}</span>
                    支付人：<span>{$z.pu}</span>  支付时间：<span>{$z.zftime}</span> 支付金额：<span class="ObjectNum num2">{$z.jine}</span>元
                </td>
               
            </tr>
             {/volist}
             {/if}
                
       
        </table>
         {if $apply.fujian}
            <table class="table-bordered table" style="margin-top:0">
            <tr>
              <td>附件列表</td>

            </tr>
            <tr><td>
               {volist name="fujian" id="f"}
                    <a onclick="down({$f.id})">{$f.file_name}</a>&nbsp;&nbsp;
                  {/volist}
            </td></tr>
              </table>
               
        {/if}
         <div class="row padding-10 text-center">
            <!--<button class="btn btn-primary" type="button" id="bc">拆分至领导审批</button>
            <button class="btn btn-info" type="button">打回修改</button>
             <button class="btn btn-success" type="button">审批通过</button>-->
             <button class="btn btn-info" type="button" id="bc">保存并返回决策宝</button>
             <button class="btn btn-primary" type="button" id="bcnext">保存进入下一步</button>
             <button class="btn btn-success" type="button" id="fanhui">返回决策宝</button>
        </div>
        {if $apply.state==7}
       <div class="SuccessImg font-bold">
        已&nbsp;生&nbsp;效
      </div> 
      {/if}
      {if $apply.state==8}
      <div class="applyImg font-bold">
        已&nbsp;作&nbsp;废
      </div>
      {/if}

     <!--  <div class="SuccessImg font-bold">
        已&nbsp;生&nbsp;效
      </div> -->
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    
<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
        <script src="__STATIC__/layout/js/common.js"></script>
        <script>
        $(".pizhun").blur(function(){
             if(isNaN(parseFloat($(this).val()))){
                $(this).val(0)
            }else{
                $(this).val(parseFloat($(this).val()).toFixed(2))
            }
            jisuan();
        })
        $(".fj").change(function(){
            var did=$(this).attr("did");
            if($(this).prop("checked")){
                
                $(".pizhun[did='"+did+"']").prop("readonly",true)
                $(".pizhun[did='"+did+"']").val(0);
            }else{
                 $(".pizhun[did='"+did+"']").prop("readonly",false)
            }
            jisuan()
        })
        $(".pz").change(function(){
              var did=$(this).attr("did");
            if($(this).prop("checked")){
                $(".pizhun[did='"+did+"']").prop("readonly",false)
                
            }else{
                 $(".pizhun[did='"+did+"']").prop("readonly",true)
                $(".pizhun[did='"+did+"']").val(0);
                jisuan()
            }
        })
        </script>
        <script>
        $("#bcnext").click(function(){
              $.ajax({
              cache: true,
              type: "POST",
              url:"{:url('shenpisave')}",
              data:$('#f1').serialize(),// 你的formid
              async: true,
              error: function(request) {
                alert("Connection error");
              },
              success: function(data) {
                //alert(data);
                 var re=JSON.parse(data);
                 if(re["state"]==2){
                    swal({
                        title: "错误",
                        text:  re["msg"],
                        type: "warning"
                        });
                }else{
                     location.href='{:url("Workflowdb/gzlsp",["workId"=>request()->param("workId"),"trackId"=>request()->param("trackId")])}'
                }
              }
            })
        })
        $("#bc").click(function(){
              $.ajax({
              cache: true,
              type: "POST",
              url:"{:url('shenpisave')}",
              data:$('#f1').serialize(),// 你的formid
              async: true,
              error: function(request) {
                alert("Connection error");
              },
              success: function(data) {
                //alert(data);
                 var re=JSON.parse(data);
                 if(re["state"]==2){
                    swal({
                        title: "错误",
                        text:  re["msg"],
                        type: "warning"
                        });
                }else{
                     location.href='{:url("shenhe",["workId"=>request()->param("workId"),"trackId"=>request()->param("trackId"),"myId"=>request()->param("myId")])}'
                }
              }
            })
        })
    
        $("#fanhui").click(function(){
            location.href='{:url("shenhe",["workId"=>request()->param("workId"),"trackId"=>request()->param("trackId"),"myId"=>request()->param("myId")])}'
            return false
        })
        function daochu(aid){
            window.open("{:url('Rcexecel/mingxi')}?aid="+aid)
        }
        function down(id){
          window.open("{:url('download_fujian')}?fid="+id)
        }

                $(document).ready(function(){
                     $(".num2").each(function(){
                        if(isNaN(parseFloat($(this).html()))){
                             $(this).html(0)
                        }else{
                            $(this).html(parseFloat($(this).html()).toFixed(2))
                        }
                    })
                  
                    jisuan()
                    var $ObjectNum =$(".ObjectNum");
                       toNum($ObjectNum);
                })
        function jisuan(){
              var feinum={$feiyongnum};
                    var zonghe=0;
                    for(var i=1;i<=feinum;i++){
                        var he=0;
                        $(".jisuan"+i).each(function(){
                            he+=parseFloat($(this).val());
                        })
                        $(".he"+i).html(he);
                        zonghe+=parseFloat(he);
                    }
                    $(".zonghe").html(zonghe)
        }
        </script>


<script>
    $(".detail").click(menuItem);
    function menuItem() {
    // 获取标识数据
    var dataUrl = $(this).attr('href'),
        dataIndex = $(this).data('index'),
        menuName = $.trim($(this).attr("title")),
        flag = true;
    if (dataUrl == undefined || $.trim(dataUrl).length == 0)return false;

    // 选项卡菜单已存在
    top.$('.J_menuTab').each(function () {
        if ($(this).data('id') == dataUrl) {
            if (!$(this).hasClass('active')) {
                $(this).addClass('active').siblings('.J_menuTab').removeClass('active');
                scrollToTab(this);
                // 显示tab对应的内容区
                top.$('.J_mainContent .J_iframe').each(function () {
                    if (top.$(this).data('id') == dataUrl) {
                        top.$(this).show().siblings('.J_iframe').hide();
                        return false;
                    }
                });
            }
            flag = false;
            return false;
        }
    });

    // 选项卡菜单不存在
    if (flag) {
        var str = '<a href="javascript:;" class="active J_menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>';
        top.$('.J_menuTab').removeClass('active');

        // 添加选项卡对应的iframe
        var str1 = '<iframe class="J_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
        top.$('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1);

        //显示loading提示
//            var loading = layer.load();
//
//            $('.J_mainContent iframe:visible').load(function () {
//                //iframe加载完成后隐藏loading提示
//                layer.close(loading);
//            });
        // 添加选项卡
        top.$('.J_menuTabs .page-tabs-content').append(str);
        scrollToTab(top.$('.J_menuTab.active'));
    }
    return false;
}
//滚动到指定选项卡
function scrollToTab(element) {
    var marginLeftVal = calSumWidth(top.$(element).prevAll()), marginRightVal = calSumWidth(top.$(element).nextAll());
    // 可视区域非tab宽度
    var tabOuterWidth = calSumWidth(top.$(".content-tabs").children().not(".J_menuTabs"));
    //可视区域tab宽度
    var visibleWidth = top.$(".content-tabs").outerWidth(true) - tabOuterWidth;
    //实际滚动宽度
    var scrollVal = 0;
    if (top.$(".page-tabs-content").outerWidth() < visibleWidth) {
        scrollVal = 0;
    } else if (marginRightVal <= (visibleWidth - top.$(element).outerWidth(true) - top.$(element).next().outerWidth(true))) {
        if ((visibleWidth - top.$(element).next().outerWidth(true)) > marginRightVal) {
            scrollVal = marginLeftVal;
            var tabElement = element;
            while ((scrollVal - top.$(tabElement).outerWidth()) > (top.$(".page-tabs-content").outerWidth() - visibleWidth)) {
                scrollVal -= top.$(tabElement).prev().outerWidth();
                tabElement = top.$(tabElement).prev();
            }
        }
    } else if (marginLeftVal > (visibleWidth - top.$(element).outerWidth(true) - top.$(element).prev().outerWidth(true))) {
        scrollVal = marginLeftVal - top.$(element).prev().outerWidth(true);
    }
    top.$('.page-tabs-content').animate({
        marginLeft: 0 - scrollVal + 'px'
    }, "fast");
}
//计算元素集合的总宽度
function calSumWidth(elements) {
    var width = 0;
    top.$(elements).each(function () {
        width += top.$(this).outerWidth(true);
    });
    return width;
}


    </script>
</body>

</html>
